package com.softeem.score.manager.properties;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
//注意prefix要写到最后一个 "." 符号之前
//调用setter为成员赋值
@ConfigurationProperties(prefix = "score.aliyun.sms")
public class SmsProperties implements InitializingBean {
    private String host;
    private String path;
    private String method;
    private String appcode;
    private String templateId;
    private String smsSignId;

    public static String HOST;
    public static String PATH;
    public static String METHOD;
    public static String APPCODE;
    public static String TEMPLATEID;
    public static String SMSSIGNID;

    //当私有成员被赋值后，此方法自动被调用，从而初始化常量
    @Override
    public void afterPropertiesSet() throws Exception {
        HOST = host;
        PATH = path;
        METHOD = method;
        APPCODE = appcode;
        TEMPLATEID = templateId;
        SMSSIGNID = smsSignId;
    }
}